最近在 oschina 看到有朋友用 golang 寫了一套 based on HBase 的即時通訊軟體(原設計是 MySQL),而 Qmi 也是基於 HBase 的即時通訊軟體。雖然小編不會寫 golang,但看 code 總還可以的,所以小編當然要來研究一下這個 tim 是如何設計 schema 的。
看起來 rowkey 就是用 HBase 的 increment 指令完成,然後再將 int 轉成 hex 後做為 rowkey。而 family 則有 n 個 (感覺就是欄位名的樣子),然後 family 為 idx 開頭的就是 foreign key。
除了 rowkey 以外,family, qualifier, value 的設計邏輯,更讓小編有點不解 Orz
* 如果 family 是 # 開頭的話 (一般是 # id),則 qualifier 為空,value 為 rowkey 的值
* 如果 family 是 idx_ 開頭,則 family 為 index,qualifier 為欄位的內容 (像是 IndexDomainUsername 的值),value 為空
* 一般欄位則 family 為欄位名稱,qualifier 為空,value 為欄位的內容 (像是 fromuser 的值)
對 HBase 設計比較了解的朋友會知道,rowkey 會影響讀寫的效能,依照 ascii 碼排序,愈分散就愈不會遇到 hotspot,但愈集中一次能取回的資料就愈多,這都是要看 scenario 決定。而 family 與 HFile 成正比,family 愈多,開的檔案愈多,一般建議不超過三個,而這裡一筆 record 就開了十幾個。另外除了 value 以外,naming 要儘量簡短。
看完之後,覺得跟這幾年小編在 HBase 上設計 schema 的原則完全不同啊。不過相信有一部分或許是為了要相容於 RDBMS 的關係,而不得不做的取捨吧 Orz
* https://www.oschina.net/news/78341/tim-1-1-0
* https://github.com/donnie4w/tim/blob/master/tim.hbase/hbaseService.go
* https://github.com/donnie4w/tim/blob/master/tim.hbase/hbasedao.go
* https://github.com/donnie4w/tim/blob/master/doc/hbaseTable.txt
#qmi #tim #hbase #golang
同時也有4部Youtube影片,追蹤數超過12萬的網紅prasertcbs,也在其Youtube影片中提到,เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs สอน PostgreSQL ► https://www.youtube.com/playlis...
foreign key mysql 在 prasertcbs Youtube 的最佳貼文
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs
สอน PostgreSQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGi_NqmIu43B-PsxA0wtnyH
สอน MySQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GFmJDsZipFCrY6L-0RrBYLT
สอน Microsoft SQL Server 2012, 2014, 2016, 2017 ► https://www.youtube.com/playlist?list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
สอน SQLite ► https://www.youtube.com/playlist?list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
สอน SQL สำหรับ Data Science ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGq8M6HO8xrpkaRhvEBsQhw
การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python ► https://www.youtube.com/playlist?list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access) ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
#prasertcbs_SQL #prasertcbs #prasertcbs_PostgreSQL

foreign key mysql 在 prasertcbs Youtube 的最佳解答
ดาวน์โหลด PostgreSQL script ไฟล์ที่ใช้ในคลิปได้ที่ ► http://bit.ly/2kg9yLC
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่ ► https://www.youtube.com/subscription_center?add_user=prasertcbs
สอน PostgreSQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGi_NqmIu43B-PsxA0wtnyH
สอน MySQL ► https://www.youtube.com/playlist?list=PLoTScYm9O0GFmJDsZipFCrY6L-0RrBYLT
สอน Microsoft SQL Server 2012, 2014, 2016, 2017 ► https://www.youtube.com/playlist?list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
สอน SQLite ► https://www.youtube.com/playlist?list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
สอน SQL สำหรับ Data Science ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGq8M6HO8xrpkaRhvEBsQhw
การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python ► https://www.youtube.com/playlist?list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access) ► https://www.youtube.com/playlist?list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
#prasertcbs_SQL #prasertcbs #prasertcbs_PostgreSQL

foreign key mysql 在 prasertcbs Youtube 的最佳解答
อธิบายถึงการทำงานของ Foreign Key ที่ถูกสร้างขึ้นเมื่อมีการสร้าง referential integrity ระหว่างตาราง
ปัญหาที่มักพบเมื่อทำการสร้าง referential integrity
ดาวน์โหลดฐานข้อมูล Yummi2014 ได้ที่ http://goo.gl/elJ64i
============
playlist สอน Microsoft SQL Server 2012, 2014, 2016
https://www.youtube.com/watch?v=IQdjbBrm38s&list=PLoTScYm9O0GH8gYuxpp-jqu5Blc7KbQVn
============
playlist สอน SQLite
https://www.youtube.com/watch?v=BL1ncKBW3jw&list=PLoTScYm9O0GHjYJA4pfG38M5BcrWKf5s2
============
playlist การใช้ Excel ในการทำงานร่วมกับกับฐานข้อมูล (SQL Server, MySQL, Access)
https://www.youtube.com/watch?v=HfKl6eOfNFo&list=PLoTScYm9O0GGA2sSqNRSXlw0OYuCfDwYk
============
playlist การเชื่อมต่อกับฐานข้อมูล (SQL Server, MySQL, SQLite) ด้วย Python
https://www.youtube.com/watch?v=2n2SLFET-GU&list=PLoTScYm9O0GEdZtHwU3t9k3dBAlxYoq59
============
เชิญสมัครเป็นสมาชิกของช่องนี้ได้ที่
https://www.youtube.com/subscription_center?add_user=prasertcbs

foreign key mysql 在 以MySQL 為例解釋外鍵(Foreign Key) - 一顆藍莓 的相關結果
外鍵(Foreign Key)是指向其他表的主鍵(Primary Key)的欄位,用於確定兩張表的關聯性及資料完整性,以避免部分資料匹配不上的問題。 ... 接下來會以MySQL ... ... <看更多>
foreign key mysql 在 13.1.17.5 FOREIGN KEY Constraints - MySQL :: Developer Zone 的相關結果
In MySQL, InnoDB and NDB tables support checking of foreign key constraints. Foreign key checking is controlled by the foreign_key_checks variable, which is ... ... <看更多>
foreign key mysql 在 SQL FOREIGN KEY Constraint - W3Schools 的相關結果
To allow naming of a FOREIGN KEY constraint, and for defining a FOREIGN KEY constraint on multiple columns, use the following SQL syntax: MySQL / SQL Server ... ... <看更多>